

const pluginFeatureDAO = require('../rdsService/pluginFeatureDAO');

const { localPluginWarper } = require('../warper/pluginWarper')

exports.getLocalPluginByFileName = function (fileName) {

    return new Promise(function (resolve, reject) {
        pluginFeatureDAO.getPluginFeatureByCondition(null, null, null, "fileName", "file", fileName, "search", null, (features) => {
            if (features.length == 0) {
                return resolve([])
            } else {
                return resolve(localPluginWarper(features))
            }
        })
    })
}



exports.getLocalPluginByFileType = function (fileName) {
    const fileType = fileName.split('.').pop()
    return new Promise(function (resolve, reject) {
        pluginFeatureDAO.getPluginFeatureByCondition(null, null, null, "regular", "file", fileType, "search", keyword, (features) => {
            if (features.length == 0) {
                return resolve([])
            } else {
                return resolve(localPluginWarper(features))
            }
        })
    })
}